package cn.clj.func;

import java.util.List;

/**
 * 函数参数
 * */
public class CljFuncParam {
    private String name;
    private String restParam;
    private List<CljFuncParamList> cljFuncParamList;

    public CljFuncParam(List<CljFuncParamList> cljFuncParamList) {
        this.cljFuncParamList = cljFuncParamList;
    }

    public CljFuncParam(String name) {
        this.name = name;
    }

    public CljFuncParam() {}

    @Override
    public String toString() {
        if (name != null) {
            return name;
        }
        else if (restParam != null)
        {
            return "& " + restParam;
        }
        else if (cljFuncParamList != null)
        {
            StringBuilder sb = new StringBuilder();
            sb.append("[");
            for (CljFuncParamList m : cljFuncParamList)
            {
                sb.append(m.getName());
            }
            sb.append("]");
            return sb.toString();
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRestParam() {
        return restParam;
    }

    public void setRestParam(String restParam) {
        this.restParam = restParam;
    }

    public List<CljFuncParamList> getCljFuncParamList() {
        return cljFuncParamList;
    }

    public void setCljFuncParamList(List<CljFuncParamList> cljFuncParamList) {
        this.cljFuncParamList = cljFuncParamList;
    }
}
